namespace Digitalmes.Domain.Mes;

/// <summary>
/// 设备点检单表
/// </summary>
[SugarTable("equip_check_doc", "设备点检单表")]
public class EquipCheckDoc : EntityBase
{
    /// <summary>
    /// 点检单据号
    /// </summary>
    [NotNull]
    public string? Doc { get; set; }

    /// <summary>
    /// 设备Id
    /// </summary>
    public long EquipId { get; set; }

    /// <summary>
    /// 设备编号
    /// </summary>
    [NotNull]
    public string? EquipCode { get; set; }

    /// <summary>
    /// 设备名称
    /// </summary>
    [NotNull]
    public string? EquipName { get; set; }

    /// <summary>
    /// 点检时间
    /// </summary>
    public DateTime? CheckTime { get; set; }

    /// <summary>
    /// 点检状态（1->已创建; 2->已完成）
    /// </summary>
    public int Status { get; set; }

    /// <summary>
    /// 点检明细项
    /// </summary>
    [Navigate(NavigateType.OneToMany, nameof(EquipCheckDocLine.DocId))]
    public List<EquipCheckDocLine>? Items { get; set; }

    /// <summary>
    /// 完成
    /// </summary>
    public void Complete()
    {
        CheckTime = DateTime.Now;
        Status = 2;
    }
}
